#ifndef ROFramedUpdater_H
#define ROFramedUpdater_H

#include <QObject>
#include <ROPropertyUpdater.h>

//帧同步更新器，每隔一段固定时间通知所有对象更新所有属性
//默认更新频率为20HZ

class QTimer;

class ROFramedUpdater:public ROPropertyUpdater
{
    Q_OBJECT
    QML_ELEMENT
public:
    ROFramedUpdater(QObject* parent = nullptr);

    int getInterval() const;
    void setInterval(int newInterval);
protected:
    QObject* registerUpdater(ROSyncProperty* source);
signals:
    void update();

    void intervalChanged();

private:
    QTimer* timer = nullptr;
    Q_PROPERTY(int interval READ getInterval WRITE setInterval NOTIFY intervalChanged FINAL)
};

#endif
